<?php use_stylesheet('main.css') ?>
<span class="heading1">Total Income</span>
<table id="data_list">
  <tbody>
    <tr>
      <th>S.no</th>
      <th>Monthly Wise Income</th>
      <th>My Returns</th>
      <th>Referal</th>
      <th>Matching</th>
      <th>Total Balance</th>
    </tr>
    <?php
    $count = 0;
    $grossTotal = 0;
    foreach ($data as $item):
    $count++;
    $grossTotal += $item->getTotal();
    ?>
    <tr>
      <td><?php echo $count; ?></td>
      <td><?php echo $item->getCreatedAt($monthlyWiseFormat); ?></td>
      <td><?php echo $currency; ?> <?php echo $item->getMyReturns(); ?></td>
      <td><?php echo $currency; ?> <?php echo $item->getReferal(); ?></td>
      <td><?php echo $currency; ?> <?php echo $item->getMatching(); ?></td>
      <td><?php echo $currency; ?> <?php echo $item->getTotal(); ?></td>
    </tr>
    <?php
    endforeach;?>
  </tbody>
  <thead>
    <tr>
      <th colspan="3">Total Income:</th>
      <td colspan="3"><?php echo $currency; ?> <?php echo $grossTotal; ?></td>
    </tr>
  </thead>
  <?php if (!count($data)): ?>
  <tfoot>
    <tr>
      <td colspan="6">Oops! No Transactions Found</td>
    </tr>
  </tfoot>
  <?php endif;?>
</table>